import { useState } from 'react';
import request from './request';
/*
 * 自定义loading hooks
 *
 * */
const Index = () => {
  const [loading, setLoading] = useState(false);
  const postData = async (api, obj) => {
    setLoading(true);
    const data = await request(api, obj);
    setLoading(false);
    return data;
  };
  return { loading, postData };
};

export default Index;
